A color extraction algorithm by segmentation

The segmentation and extraction on color features can provide useful information for many different application domains. However, most of the existing image processing algorithms on feature extraction are gray image-based and consider only one-dimensional parameters. In order to carry out a fast and accurate color feature extraction, this paper proposes a color extraction algorithm by segmentation that is called a color extraction algorithm This algorithm is compared under different color distribution situations, and the extraction effect on color is also shown by the combination of the segmentation and feature extraction algorithms. Experimental results show that such segmentation algorithm has some advantages for color segmentation. In the fuzzy color image preprocessing, this paper gives the location method of region of interest. Moreover, compared with other existing extraction algorithms, the presented segmentation extraction algorithm in this paper not only has higher accuracy, shorter extraction time and stronger anti-interference ability, but also has better effect on more divergent color edge. Experimental evaluation of the proposed color extraction algorithm demonstrates dominance over existing algorithms for feature extraction. These researches in this paper provide a new way of thinking for color feature extraction by segmentation, which has an important theoretical references and practical significance.


Denoising for image
Because of the image acquisition system, different physical phenomena such as illumination cannot be completely evenly distributed, and for many other reasons, the obtained edge intensity of the image is different.Moreover, in real-world situations, image data is often contaminated by noise.The scenery features are mixed, so it makes subsequent interpretation very difficult.To achieve an accurate grasp of the picture intent, it needs to study a target recognition method that can not only detect the non-continuity of intensity but also determine their exact position.It needs to develop new uncertainty processing methods and algorithms to solve such problems.Here, a fuzzy operator for image denoising is given as follows: Assume , and b j is the j th large element in a data set (a 1 , a 2 , • • • , a n ) , R is the set of real number, the function F is called n-dimension ordered weighted average operator (OWA operator).
The obvious feature of OWA operator is that it can firstly reorder the given decision-making data (a 1 , a 2 , • • • , a n ) in descending order and obtain a new data (b 1 , b 2 , • • • , b n ) , and aggregate the new data by the given weight vector.The weight value ω j has no relationship with the element a j , it's only related to the j th posi- tion in the aggregate process.
The OWA operator is the aggregation method of multiple attribute decision making between the maximum and minimum operator, i.e., assumed is, this method removed the maximum and minimum values, and did the arithmetic average to the rest.In some cases, the acquired most of images are fuzzy.In addition to objective reasons, there are also some subjective reasons to cause the images to be fuzzy, such as images were dissevered, soiled, etc.For the fuzziness in these images, this paper uses the fuzzy approach to process fuzzy signals based on uncertainty factor classification and influence analysis and presents a fuzzy signal processing method and algorithm that can improve image quality, as shown in Fig. 1.
The threshold value is used to smooth image processing and eliminate the fuzziness of the image.

Color feature segmentation
We propose a probabilistic algorithm for segmentation to color images.This algorithm is based on the probability that the color of the homochromy pixel possesses in the entire region of interest (ROI).Its specific definition is as follows: Definition 1 Divide the ROI of a color image.Calculate the number of pixels in ROI is n , and the number of pixels of a single color is m .Label the single color as l c .Then the calculation of percentage of the single color l c in the ROI is called a probabilistic algorithm, and is defined as: This algorithm relies on the proportion that the pixel occurs in ROI.The ROI is chosen by the requirements of the target or testing.The ROI can be automatically chosen however it can be also manually chosen.For the ROI of color, the selection of an ROI is done through the value of hue.In the following subsections, we present selection algorithms for ROI.
If the composition of the color of the image is clear, the luminance value of each pixel is counted.The number of pixels of some colors can be computed by the luminance value.The counted pixels of each color are marked, respectively, and then the ROI can be marked out.In the simulation, we select the range of luminance value of the pixel as [200,230], and use the "red" to mark the pixel.The simulation result is shown in Fig. 2, in which the red region is the delineated ROI.

Enhancement to image
If a public threshold value is shared in all directions, then the enhancement method is called a public threshold enhancement.If the different threshold value is used in a different direction, the enhancement method is called an alone threshold enhancement.
According to experimental analysis, the weighting function ω = [0.95,0.85, 0.8; 0.8, -8.1, 0.7; 0.85, 0.95, 1.2] is used to adjust the image I , and the image is adjusted as follows: Then, the image smoothing is carried out by the 5 layers coefficient decomposition of the wavelet haar, and then the image is enhanced by using the threshold to sharpen it.By this proposed weight segmentation enhancement method for image, the quality of the color image is improved, and its clarity degree is also improved.
To compare the proposed weight segmentation enhancement method with the existing edge color enhancement and color mean methods, the proposed enhancement method has a faster processing speed and a better effect than other enhancement methods for images, as is shown in Fig. 3.

Adjustment of gray
Firstly, convert the original RGB image into the gray image, and then adjust the range of the gray image from [0.3, 0.8] to [0, 1], to obtain a clearer texture pattern of the finger.Figure 4 shows the histogram of the image before and after adjustment.By the histogram, the grayscale range of distribution is uniform after the image transforms, therefore, an image with clearer texture information is obtained. In

Extraction of edge contour
The image border is the discontinuous reflection of local characteristics of an image, such as the mutation of gray level, colors, and texture, which marks the end of a region and the beginning of another region.For calculation simplicity, the first-order derivative or the second derivative is usually used to check the border of an image.It can be easy to detect the discontinuity of the gray level by taking advantage of the derivative method.The detection of borders can be realized by the convolution based on the spatial differential operators.Some smoothness and binarization processing should be done before the extraction of the border is implemented.
Assume the original fingerprint image is f ′ (x, y) , the smooth filtering to f ′ (x, y) in a spatial domain can be carried out by using a low-pass filter H and the output image is g(u, v) , as shown in equation.www.nature.com/scientificreports/A relative complete image of fingerprint edge can be obtained after filtering.Then a binarization processing for image g(u, v) is carried out by choosing a proper threshold value h .As shown in equation, the processed image is f (x, y).
Then the edge detection for the binarization image can be carried out in image width and image height directions by making use of gray-level mutation.

Detection and extraction of feature points
The texture of the color image is clear through processing by the above step, so it is easy to better implement the detection of characteristic points and tracking them.According to the color level jump algorithm given above, it can not only achieve image edge detection but also can detect a corner point, endpoint, bifurcation points, etc.The detection of corner points based on the color level jump algorithm is shown in Fig. 5.
The characteristic points are the endpoints, corner points, bifurcation points, etc., which the papillary ridges form on the figure.The type of corner points detected by the color level jump algorithm is various, so it requires filtering the detected corner points.Select an enough small radius r , and then take the corner points as the center of circle to draw a circle.We detect the times of change of color level along this circle.If there are three sharp growth values or sharp reduction values of color level jump at a certain point, the point is a characteristic point.

Comparison of proposed algorithm with the existing algorithms
In this paper, the proposed color segmentation algorithm and existing algorithms such as Robert, Sobel, Prewitt, Laplace, and Canny are compared by more experiments.
The experimental equipment for this comparison is a computer with Inter I7 6-core CPU, 32GB memory, and a 64-bit Windows 10 system.The experimental platform is Matlab2020 and Python3.7.
Figure 6 gives the extraction process of fingerprint edge based on the mutation algorithm, and shows the comparison between this mutation algorithm and the existing best Canny extraction algorithm to fingerprint.
(1) www.nature.com/scientificreports/From Fig. 6, the marginal branches are many based on the Canny algorithm to the contour extracted.However, the edge contour effect extracted by the proposed extraction algorithm is good, because the extracted edge is smooth and the contours can basically locate the target region.
For feature extraction of color images, the extraction results which are given by two color feature extraction algorithms proposed in this paper and existing relevant extraction algorithms to edge and corner of color image are compared.
The simulation results show that the extraction effect of the pixel probabilistic algorithm to the color with ambiguous boundary is good, and its processing speed is fast.For a color image with size 362 × 500, the pixel probabilistic algorithm for the image processing is used, its processing time is 0.516 s, but its eliminating noise ability is relatively weak.However, the color segmentation algorithm is used to extract features of color, such as edges, corners, bifurcation points, and so on.The results show that its extraction effect is not only good, but also it can detect the edge direction information, as well as its eliminating noise ability is strong, and its processing speed is faster.For a color image with 362 × 500, its processing times are only 0.157 s.Moreover, this algorithm in use is flexible, which is because some thresholds, such as the threshold of the comparison function, threshold of edge response, and threshold of corner response, can be differently set in simulation based on actual situation and experimental analysis.However, the classical Robert, Sobel, and Prewitt operators could not detect the edges of some straight lines, and neither could not detect the part edges of a circle.Though Gauss-Laplace and Canny operators could basically detect all the edges, their positioning effect is relatively poor, the edge pixels detected by them are wider, and the edges and corners extracted by them all were lost much.Their processing speed is slightly slow.For a color image with 362 × 500, the average processing time of the proposed algorithm is 0.157 s, however, Sobel, Laplace, and Prewitt operators are about 13.969 s, that of Robert is 0.75 s, that of Canny is 21.93 s.Moreover, their eliminate noise ability is weak.Simulation results are shown in Fig. 7bs-gs, and as are the original image.
To verify the color feature matching accuracy of the edge extraction algorithm proposed in this paper, the data is selected again in the data set for accuracy testing.Establish a standard template database.300 different targets were randomly selected from the self-sampling image database.Choosing 3 randomly from 10 target images of each target to form a total of 500 target images.
A total of 300 target images were randomly selected from the three target images of each target to form the experimental target image database.The remaining 200 target images are from the test sample library.
Using the algorithm proposed in this paper to extract color features from 300 target images in the established target image database.A set of color feature vectors decomposed by 300 templates can be obtained.Each feature set contains 300 feature vectors.The extracted feature vectors are stored in the collected natural image archive as training samples.
The correctness of the color feature extraction is verified, and the verification steps are as follows: Step 1.Using template transformation to decompose and extract the color of the target image in the test sample library, and obtain the color features of two-layer template decomposition.Then the obtained feature vector is matched with the samples in the image database.
Step 2. Matching the image color features to be tested with all sample colors in the image database, conducting 500 random selection and matching tests, and judging the vector features corresponding to the most similar colors as the test results.
Step 3. Performing 500 inspections for each image in the test sample database according to steps 1 ~ 2, record the number of correct inspections and incorrect inspections, and calculate the correct inspection rate.
From the result analysis, for each target image, the template transformation was selected in the simulation, and the experiments were repeated 20 times according to steps P1 to P3, and different numbers of samples were taken for each experiment.It is compared with Gabor and the statistical test algorithms that are widely used at present.The correct average extraction rate of the proposed segmentation algorithm for 500 simulations is 95.26%, however, that of the existing best algorithms is 91.25%.
The proposed algorithm is not only effective in processing time but also improves the recognition accuracy by an average of about 4% compared with the existing best algorithms.The extraction accuracy of the several algorithms is shown in Fig. 8.
To evaluate the overall performance of each algorithm, we adopt the combination of quantitative analysis and qualitative analysis algorithms and synthesize comparisons based on several factors such as the correct color extraction rate, processing speed, anti-noise capability, loss of color, and so on.We evaluate the merits and demerits of the proposed algorithm and existing algorithms.Table 1 gives the results of a comprehensive comparison.
From Table 1 and Fig. 8, the correct color extraction rate of the proposed color segmentation algorithm to color image is higher than that of existing algorithms, its processing speed is the fastest among several algorithms, its anti-noise ability is stronger, as well as the loss of color extracted by the algorithm is less than that by other algorithms.In a word, its robustness is the best.

Conclusion
This paper studies the features of color images, presents the feature extraction of three-dimensional parameter color images, gives the extraction algorithms of edges and corners, as well as gives the comparison and experiment of the two algorithms under different color distributions.Finally, for feature extraction of color images, the extraction results which are given by the two proposed algorithms and existing extraction algorithms to the edge and corner of the color image are compared.For the similar color segment algorithm to extract the features of a color image, such as edges, corners, bifurcation points, and so on, the simulation results indicate that it has a better extraction effect, stronger anti-noise ability, faster processing speed, more flexible use, as well as can detect the edge direction information.In future work, the method proposed in this paper goes for further optimization both in terms of complementing the image detail information and further noise reduction.The excellent performance in fingerprint information extraction can apply this technology to similar medical or security applications.The extraction of information from color images can be extended to livestock quality control and other fields.

Figure 1 .
Figure 1.Denoising processing to fuzzy image.(a) Image with noise.(b) Denoising processing by fuzzy operator.

Fig. 4 ,
(a) is a gray image that the original RGB image is converted into.(b) is an image after the range of gray is adjusted.(c) is a histogram of the gray image.(d) is a histogram after the gray image is adjusted.

Figure 2 .
Figure 2. ROI chosen by computing the number of pixels of some colors.

Figure 3 .Figure 4 .
Figure 3.Comparison of the proposed weight segmentation and existing enhancement methods.(a) Original image.(b) By proposed weight segmentation.(c) By existing edge color enhancement.(d) By existing mean method.

Figure 5 .
Figure 5. Detection and extraction to feature points based on above algorithm.(a) Original image.(b) Chosing ROI.(c) Feature detection in ROI.(d) Feature extraction in ROI.

Figure 6 .
Figure 6.Comparison of fingerprint edge extraction between proposed and existing Canny.

Figure 7 .Figure 7 .Figure 8 .
Figure 7. Comparisons of feature extraction of the proposed color segmentation and existing algorithms to color image.(I) Image to fish.(a) Image to color feature.(b) Extraction by proposed segmentation.(c) Extraction by Sobel.(d) Extraction by Canny.(e) Extraction by Prewitt.(f) Extraction by Robert.(g) Extraction by Laplace.(II) Image to turtle.(a) Image to color feature.(b) Extraction by proposed segmentation.(c) Extraction by Sobel.(d) Extraction by Canny.(e) Extraction by Prewitt.(f) Extraction by Robert.(g) Extraction by Laplace.

Table 1 .
Comprehensive comparison of several color extraction algorithms.